import request from './request';

// 用户注册
export const register = (userData) => {
  return request.post('/users/register', userData);
};

// 用户登录
export const login = (userData) => {
  return request.post('/users/login', userData);
};

// 获取当前登录用户信息
export const getCurrentUser = () => {
  return request.get('/users/current');
};

// 获取所有用户(仅管理员)
export const getAllUsers = () => {
  return request.get('/users');
};

// 更新用户角色(仅管理员)
export const updateUserRole = (userId, role) => {
  return request.put('/users/role', { id: userId, role });
};

// 删除用户(仅管理员)
export const deleteUser = (userId) => {
  return request.delete(`/users/${userId}`);
};